package org.example.settings.controller;

import org.example.settings.domain.Clue;
import org.example.settings.domain.DictionaryValue;
import org.example.settings.domain.User;
import org.example.settings.service.ClueService;
import org.example.settings.service.DictionaryValueService;
import org.example.settings.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@RequestMapping("/dictionaryValue")
public class DictionaryValueController {
    @Autowired
    private DictionaryValueService dictionaryValueService;

    @Autowired
    private UserService userService;
    @Autowired
    private ClueService clueService;

    @RequestMapping("/index")
    public String selectDictionaryValueByCodeType(HttpServletRequest request){
        List<User> userList = userService.findAll();
        List<DictionaryValue> appellationList = dictionaryValueService.selectDicValueByType("appellation");
        List<DictionaryValue> clueStateList = dictionaryValueService.selectDicValueByType("clueState");
        List<DictionaryValue> sourceList = dictionaryValueService.selectDicValueByType("source");
        request.setAttribute("userList",userList);
        request.setAttribute("appellationList",appellationList);
        request.setAttribute("clueStateList",clueStateList);
        request.setAttribute("sourceList",sourceList);
        return "workbench/clue/index";
    }
}
